package resource

import (
	"micro-grpc-server/services/user/internal/models"
	pb "micro-grpc-server/services/user/proto"
)

type UserResource struct{}

// 用户模型转pb
func (r *UserResource) UserToProto(identity *models.Identity) *pb.User {
	var u = &pb.User{
		Id:         identity.Id,
		Account:    identity.Account,
		Name:       identity.Name,
		Avatar:     identity.Avatar,
		UnionId:    identity.UnionId,
		TimeJoin:   identity.TimeJoin,
		TimeActive: identity.TimeActive,
		Gender:     int64(identity.Gender),
		City:       identity.City,
	}
	return u
}
